/**
 * 初始化版本管理详情对话框
 */
var DcConfigVersionRollbackDlg = {
    dcConfigVersionRollbackData : {}
};

/**
 * 清除数据
 */
DcConfigVersionRollbackDlg.clearData = function() {
    this.dcConfigVersionRollbackData = {};
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
DcConfigVersionRollbackDlg.set = function(key, val) {
    this.dcConfigVersionRollbackData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}

/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
DcConfigVersionRollbackDlg.get = function(key) {
    return $("#" + key).val();
}

/**
 * 关闭此对话框
 */
DcConfigVersionRollbackDlg.close = function() {
    parent.layer.close(window.parent.DcConfigVersion.layerIndex);
}

/**
 * 收集数据
 */
DcConfigVersionRollbackDlg.collectData = function() {
    this
    .set('version')
    .set('appId')
    .set('envId')
}

/**
 * 提交回滚
 */
DcConfigVersionRollbackDlg.rollbackSubmit = function() {

    this.clearData();
    this.collectData();

    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/dcConfigVersion/rollback", function(data){
         if (data.code == 200){
             Feng.success("回滚成功!");
             window.parent.DcConfigVersion.table.refresh();
             DcConfigVersionRollbackDlg.close();
         }else{
             Feng.error("回滚失败!" + data.message + "!");
         }
    });
    ajax.set(this.dcConfigVersionRollbackData);
    ajax.start();
}



$(function() {

});
